import actions from './actions/actions.js'

let context = require.context('./modules', true, /\.js$/);
let modules = {};
if (context && context.keys) {
  context.keys().forEach(key => {
    let keyArray = key.split('/');
    let moduleName = keyArray[keyArray.length - 1];
    moduleName = (moduleName || '').split('.js')[0];
    if (moduleName && moduleName.length) {
      const data = context(key).default;
      modules[moduleName] = data;
    }
  });
}

export default {
  modules: modules,
  actions
}
